package org.javaboy.jackson_demo.converter;

import com.fasterxml.jackson.databind.util.StdConverter;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class StringToLocalDateTimeConverter extends StdConverter<String, LocalDateTime> {

    static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");

    @Override
    public LocalDateTime convert(String value) {
        return LocalDateTime.parse(value,DATE_TIME_FORMATTER);
    }
}
